package com.eflying.book.service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.eflying.book.bean.Book;
import com.eflying.book.dao.BookDao;
import com.eflying.pager.Expression;
import com.eflying.pager.PageBean;

public class BookService {
	private BookDao bookDao = new BookDao();
	/**
	 * 按分类查询
	 * @param cid
	 * @param pc
	 * @return
	 */
	public PageBean<Book> findByCategory(String cid , int pc){
		try {
			return bookDao.findByCategory(cid, pc);
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
	/**
	 * 按书名模糊查询
	 * @throws SQLException 
	 */
	public PageBean<Book> findByBname(String bname , int pc){
		try {
			return bookDao.findByBname(bname, pc);
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
	/**
	 * 按作者，出版社，多条件组合等。。。
	 */
	public PageBean<Book> findByAuthor(String author , int pc){
		try {
			return bookDao.findByAuthor(author, pc);
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
	public PageBean<Book> findByPress(String press , int pc){
		try {
			return bookDao.findByPress(press, pc);
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
	public PageBean<Book> findByCombination(Book criteria , int pc){
		try {
			return bookDao.findByCombination(criteria, pc);
		} catch (SQLException e) {
			throw new RuntimeException(e);
		}
	}
}
